# coding:utf-8

from django.db import models
import datetime

# 博客文章表
class Article(models.Model):
    title = models.CharField(max_length=50)
    subject = models.CharField(max_length=256)
    author = models.CharField(max_length=20)
    gmt_create = models.DateTimeField()
    gmt_modified = models.DateTimeField()

    class Meta:
        db_table = 'article'

# 出版商表
class Publisher(models.Model):
    name = models.CharField(max_length=30)
    address = models.CharField(max_length=50)
    city = models.CharField(max_length=60)
    state_province = models.CharField(max_length=30)
    country = models.CharField(max_length=50)
    website = models.URLField()

# 作者表
class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField()

# 书籍表
class Book(models.Model):
    title = models.CharField(max_length=100)
    authors = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publication_date = models.DateField()